<?
include ('variables.php');
include ('sessions.php');

$save_type="MySQL";


$dbh = get_master_connect();
if (!$dbh) {
                echo "We are sorry but we cannot process your request at the moment<BR>";
                exit_now();
}

if (getenv(REQUEST_METHOD) == "POST"){
	$user=validate($HTTP_POST_VARS[username]);
	$email=validate($HTTP_POST_VARS[email]);

	$password=get_reseller_password($user,$email);
	if(!$password){
		header("Location: $baseURL/lostpassword.html?ss=no match");
		exit_now();
	}else{
		system("/usr/local/admin/mail.pl  '$user' '$password' '' '' '$email' '' '$baseDomain' '/www/resellers_advanced/admin/mails/lostpassword.txt' 'lostpassword' '$baseDomain'",$err);
		if($err <> 0 && $err <> 22){
			//echo "SCRIPT ERROR : $err";
			exit();
			return 0;
		}
		header("Location: $baseURL/lostpassword.html?ss=found");
		exit_now();
	}
}


?>
